home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!news
- From: watzka@stat.uni-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: Question on pointers
- Date: 9 Apr 1996 08:16:29 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4kd6ct$h5h@sparcserver.lrz-muenchen.de>
- References: <1996Apr8.233330.139449@forest>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- ebromber@forest.drew.edu writes:
-
- >In a program there is an array of structs. One of the headers for a
- >function says void pop(stack *). My question is shouldn't there be a name
- >or identifier after the asterisk?
-
- A name for the formal parameter of a function is not needed in a
- function declaration. So, if this is a declaration, a "name" can
- be supplied (and it sometimes is used by compilers to create
- "better" diagnostics), but it is not needed.
-
- >My friend says that it is the address of
- >a stack in the array.
-
- ?????
-
- >If this is true, how could I access the thing
- >pointed to?
-
- You have to have names for formal parameters in a function _definition_.
- The parameter can be accessed through its name.
-
- >Here are some lines which define a stack
-
- >typedef struct item item;
- >struct item {
- > struct item *next;
-
- If you have "typedef"ed "item", why don't you use it as in
-
- item *next;
-
- > char c;
- > }
- >typedef item *stack;
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
-